package com.dldata.devtools30.service.api;


import com.dldata.devtools30.entity.DevtApiTjoptcheckEntity;
import com.dldata.devtools30.repository.api.DevtApiTjoptcheckEntityDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collections;
import java.util.List;

/**

 */
@Component
@Transactional
public class DevtApiTjoptcheckEntityService {

    @Autowired
    private DevtApiTjoptcheckEntityDao pfunctiontjoptcheckdao;

    public List<DevtApiTjoptcheckEntity> getAllFormFieldCheck(){
        return pfunctiontjoptcheckdao.getAllFormFieldCheck();
    }

    public List<DevtApiTjoptcheckEntity > getAllFormFieldCheck(String serach,String subId){
        return pfunctiontjoptcheckdao.getAllFormFieldCheck(serach,subId);
    }

    public List<DevtApiTjoptcheckEntity > findById(String id){
        return pfunctiontjoptcheckdao.findById(id).
                map(Collections::singletonList).
                orElse(Collections.emptyList());
    }


    public void save(DevtApiTjoptcheckEntity  sysCrfFormFieldcheckEntity ){
        pfunctiontjoptcheckdao.save(sysCrfFormFieldcheckEntity);
    }

    public DevtApiTjoptcheckEntity  findOne(String id){
        return pfunctiontjoptcheckdao.findById(id).get();
    }

    public List<DevtApiTjoptcheckEntity > getAllFormFieldByFormId(String subId){
        return pfunctiontjoptcheckdao.getFormFieldCheckByFormId(subId);
    }

    public List<DevtApiTjoptcheckEntity > getActieFormFieldCheckByFormId(String subId){
        return pfunctiontjoptcheckdao.getActieFormFieldCheckByFormId(subId);
    }

    public void deleteOne(String id){
        pfunctiontjoptcheckdao.deleteById(id);
    }
}
